package cz.data.common.database.utils;

import cz.data.common.support.db.DbType;

public class DbDialectUtils {

    public static String fieldAddQuoting(String dbType, String field) {
        if (DbType.ORACLE.getDb().equals(dbType) ||
                DbType.ORACLE_12C.getDb().equals(dbType) ||
                DbType.POSTGRE_SQL.getDb().equals(dbType)) {
            return "\"" + field + "\"";
        } else if (DbType.MYSQL.getDb().equals(dbType) ||
                DbType.MARIADB.getDb().equals(dbType)) {
            return "`" + field + "`";
        } else if (DbType.SQL_SERVER.getDb().equals(dbType) ||
                DbType.SQL_SERVER2008.getDb().equals(dbType)) {
            return "\"" + field + "\"";
        }
        return field;
    }
}
